replacing characters in string javascript

47

replacing characters in string javascript -

var myStr = 'this,is,a,test';
var newStr = myStr.replace(/,/g, '-');

console.log( newStr );  // "this-is-a-test"

Comments

Submit
0 Comments